import { deleteRequest, getRequest, postRequest, putRequest } from '@/utils/request.js'

export const systemApi = {
  // 枚举管理
  getEnum: (data) => {
    return getRequest('/v1/api/common/enum', data)
  },

  // 系统配置
  sysConfigList: (data) => {
    return getRequest('/v1/admin/sys/config/list', data)
  },
  sysConfigEdit: (data) => {
    return putRequest('/v1/admin/sys/config/edit', data)
  },
  // 系统菜单
  sysMenuList: (data) => {
    return getRequest('/v1/admin/sys/menu/list', data)
  },
  sysMenuSave: (data) => {
    return postRequest('/v1/admin/sys/menu/save', data)
  },
  sysMenuDelete: (data) => {
    return deleteRequest('/v1/admin/sys/menu/delete', data)
  },
  sysMenuEdit: (data) => {
    return putRequest('/v1/admin/sys/menu/edit', data)
  },
  sysMenuUpdateStatus: (data) => {
    return putRequest('/v1/admin/sys/menu/update/status', data)
  },

  // 角色权限
  sysMenuRoleList: (data) => {
    return getRequest('/v1/admin/sys/menu/role/list', data)
  },
  sysMenuRoleSave: (data) => {
    return postRequest('/v1/admin/sys/menu/role/save', data)
  },
  sysRolePage: (params, pageCurrent = 1, pageSize = 20) => {
    return getRequest('/v1/admin/sys/role/page', { pageCurrent, pageSize, ...params })
  },
  sysRoleSave: (data) => {
    return postRequest('/v1/admin/sys/role/save', data)
  },
  sysRoleDelete: (data) => {
    return deleteRequest('/v1/admin/sys/role/delete', data)
  },
  sysRoleEdit: (data) => {
    return putRequest('/v1/admin/sys/role/edit', data)
  },
  sysRoleUpdateStatus: (data) => {
    return putRequest('/v1/admin/sys/role/update/status', data)
  },
  sysRoleSort: (data) => {
    return putRequest('/v1/admin/sys/role/sort', data)
  },

  // 系统用户
  sysRoleUserSave: (data) => {
    return postRequest('/v1/admin/sys/role/user/save', data)
  },
  sysRoleUserList: (data) => {
    return getRequest('/v1/admin/sys/role/user/list', data)
  },
  sysUserPage: (params, pageCurrent = 1, pageSize = 20) => {
    return getRequest('/v1/admin/sys/user/page', { pageCurrent, pageSize, ...params })
  },
  sysUserSave: (data) => {
    return postRequest('/v1/admin/sys/user/save', data)
  },
  sysUserDelete: (data) => {
    return deleteRequest('/v1/admin/sys/user/delete', data)
  },
  sysUserEdit: (data) => {
    return putRequest('/v1/admin/sys/user/edit', data)
  },
  sysUserUpdateStatus: (data) => {
    return putRequest('/v1/admin/sys/user/update/status', data)
  },
  sysUserSort: (data) => {
    return putRequest('/v1/admin/sys/user/sort', data)
  },
  sysUserPassword: (data) => {
    return putRequest('/v1/admin/sys/user/password', data)
  },

  // 系统日志
  sysLogPage: (data) => {
    return getRequest('/v1/admin/sys/log/page', data)
  }
}
